package com.wjm.demo.test3.tcp;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class TransClient {
    public static void main(String[] args) throws Exception {
        Socket s = new Socket("192.168.0.101", 10001);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(s.getOutputStream(), true);//true自动刷新
        BufferedReader brServerInputStream = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line = null;
        while ((line = br.readLine()) != null) {
            if ("over".equals(line)) {
                break;
            }
//            pw.print(line+"\r\n");
//            pw.flush();
            pw.println(line);

            String upperStr = brServerInputStream.readLine();//读到服务端转换后的结果打印出来
            System.out.println(upperStr);
        }
        s.close();
    }
}
